import java.util.Scanner;

public class Main15 {
    public static void main(String[] args) {
        //15、输入某年某月某日，判断这一天是这一年的第几天？
        Scanner scanner = new Scanner(System.in);
        int[] month1={31,28,31,30,31,30,31,31,30,31,30,31};

        String s = scanner.nextLine();

        String[] s1 = s.split("-");

        int year = Integer.parseInt(s1[0]);
        int month = Integer.parseInt(s1[1]);
        int day = Integer.parseInt(s1[2]);

        if(year%400==0||(year%100!=0&&year%4==0)){
            month1[1]++;
        }

        int res=0;
        for (int i = 0; i < month-1; i++) {
            res+=month1[i];
        }

        System.out.println(res+day);

    }
}
